import sys
class Solution(object):
    def findMaxAverage(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: float
        """
        ans = -sys.maxsize
        res = 0
        for i in range(len(nums)):
            res += nums[i]
            if i >= k:
                res -= nums[i - k]
            if i >= k - 1:
                ans = max(ans, (res * 1.0) / k)
        return ans






a = [6,8,6,8,0,4,1,2,9,9]


s= Solution()
m =s.findMaxAverage(a,2)
print(m)